﻿/* 基本重置和全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f9;
    color: #333;
    display: flex;
    height: 100vh; /* 使根元素占满视口高度 */
    overflow: hidden; /* 防止 body 滚动 */
}

* {
    box-sizing: border-box;
}

/* 主容器布局 */
.container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* 左侧导航栏 */
.sidebar {
    flex: 0 0 220px; /* 固定宽度，不伸缩 */
    background-color: #e9ecef;
    padding: 15px;
    border-right: 1px solid #ced4da;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* 如果内容过多则滚动 */
}

    .sidebar h2 {
        font-size: 1.1em;
        margin-top: 0;
        margin-bottom: 15px;
        color: #495057;
    }

    .sidebar ul {
        list-style: none;
        padding: 0;
        margin: 0 0 15px 0;
    }

    .sidebar li {
        margin-bottom: 5px;
    }

    .sidebar .nav-item {
        display: block;
        padding: 8px 12px;
        text-decoration: none;
        color: #343a40;
        border-radius: 4px;
        transition: background-color 0.2s ease;
    }

        .sidebar .nav-item:hover {
            background-color: #dee2e6;
        }

        .sidebar .nav-item.active {
            background-color: #007bff;
            color: white;
            font-weight: bold;
        }

    .sidebar hr {
        border: none;
        border-top: 1px solid #ced4da;
        margin: 15px 0;
    }

.action-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    margin-top: 10px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
}

    .action-button:hover {
        background-color: #5a6268;
    }


/* 主要内容区域 */
.main-content {
    flex-grow: 1; /* 占据剩余空间 */
    display: flex;
    height: 100%;
    overflow: hidden; /* 防止 main-content 自身滚动 */
}

/* 分类树 */
.tree-view {
    flex: 0 0 280px; /* 固定宽度 */
    border-right: 1px solid #ced4da;
    padding: 15px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止 tree-view 自身滚动 */
}

    .tree-view h2 {
        font-size: 1.1em;
        margin-top: 0;
        margin-bottom: 15px;
        color: #495057;
        flex-shrink: 0; /* 防止标题被压缩 */
    }

.tree-container {
    overflow-y: auto; /* 树内容过多时滚动 */
    flex-grow: 1; /* 占据剩余空间 */
}

.tree ul {
    list-style: none;
    padding-left: 20px; /* 子节点缩进 */
    margin: 0;
}

.tree li {
    padding: 3px 0;
}

.tree-node-text {
    cursor: default; /* 或 pointer 如果节点本身可点击 */
    padding: 2px 4px;
    border-radius: 3px;
}

    .tree-node-text:hover {
        background-color: #e9ecef;
    }

/* 模拟的展开/折叠图标 */
.tree-toggle, .tree-leaf {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    vertical-align: middle;
    text-align: center;
    line-height: 14px; /* 垂直居中 +/- */
    border: 1px solid #ccc;
    border-radius: 3px;
    background-color: #f8f9fa;
    font-size: 12px; /* 调整 +/- 大小 */
    font-weight: bold;
}

    .tree-toggle.expanded::before {
        content: '-';
    }

    .tree-toggle.collapsed::before {
        content: '+';
    }

.tree-leaf {
    background-color: transparent;
    border: none;
}
    /* 叶节点没有图标 */
    .tree-leaf::before {
        content: '';
    }
/* 占位 */


/* 数据表格区域 */
.data-table-container {
    flex-grow: 1; /* 占据剩余空间 */
    padding: 15px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止 data-table-container 自身滚动 */
}

    .data-table-container h2 {
        font-size: 1.2em;
        margin-top: 0;
        margin-bottom: 15px;
        flex-shrink: 0; /* 防止标题被压缩 */
    }

.table-controls {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* 防止控件被压缩 */
}

    .table-controls input {
        padding: 5px 8px;
        border: 1px solid #ced4da;
        border-radius: 4px;
        width: 200px; /* 或更宽 */
    }

    .table-controls span {
        font-size: 0.9em;
        color: #6c757d;
    }

.table-wrapper {
    flex-grow: 1; /* 表格占据剩余垂直空间 */
    overflow: auto; /* 表格内容过多时滚动 */
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse; /* 合并边框 */
}

thead th {
    background-color: #e9ecef;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: sticky; /* 列头固定 */
    top: 0;
    z-index: 1;
}

tbody td {
    padding: 8px 8px;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.95em;
    white-space: nowrap; /* 防止单元格内容换行 */
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa; /* 斑马条纹 */
}

tbody tr:hover {
    background-color: #e2e6ea; /* 悬停高亮 */
}

/* 分页控件 */
.pagination {
    margin-top: 15px;
    text-align: center;
    flex-shrink: 0; /* 防止分页被压缩 */
}

    .pagination button {
        padding: 5px 10px;
        margin: 0 3px;
        border: 1px solid #ced4da;
        background-color: #fff;
        border-radius: 4px;
        cursor: pointer;
    }

        .pagination button:hover {
            background-color: #e9ecef;
        }

    .pagination span {
        margin: 0 10px;
        font-size: 0.9em;
        color: #495057;
    }
